﻿using System;
using System.Collections.Generic;
using System.Linq;

class SortWords
{
    static void Main()
    {
        //string text = Console.ReadLine();
        string text = "Ala baaala nicaaaAla baaala nicaaa ttturrrAla baaala nicaaa ttturrr ttturrr";
        string[] array = text.Split(new char[] { ' ', ',', '!', '?' });

        Dictionary<string, int> collection = new Dictionary<string, int>();

        foreach (string word in array)
        {
            if (collection.ContainsKey(word))
            {
                collection[word]++;
            }
            else
            {
                collection.Add(word, 1);
            }
        }

        var items = from pair in collection
                    orderby pair.Key ascending
                    select pair;

        foreach (KeyValuePair<string, int> pair in items)
        {
            Console.WriteLine("{0}",pair.Key);
        }
    }
}